package com.it.a01useVariable;

import java.util.Scanner;

public class BodyFatCalculator {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入你的姓名");
        String name = sc.nextLine();
        System.out.println("请输入你的性别");
        String gender = sc.nextLine();
        System.out.println("请输入你的身高(cm)");
        double height = sc.nextDouble();
        System.out.println("请输入你的体重(kg)");
        double weight = sc.nextDouble();
        System.out.println("请输入你的年龄");
        int age = sc.nextInt();

        double BMI = weight / Math.pow(height / 100, 2);
        if("男".equals(gender)){
            System.out.println("姓名:"+name+",体脂率:"+(1.2 * BMI + 0.23 * age - 16.2));
        }else{
            System.out.println("姓名:"+name+",体脂率:"+(1.2 * BMI + 0.23 * age - 5.4));
        }
        System.out.println("姓名:"+name+",BMI:"+BMI);
    }
}
